#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e6+1000;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
char s[maxn];
LL d[maxn];
inline void pre(const char* p,LL n){
    LL i=1;LL j=0;
    memset(d,0,n*sizeof(LL));
    while(i<n){
        if(p[i]==p[j]){
            d[i++]=++j;
        }
        else{
            if(j) j=d[j-1];
            else i++;
        }
    }
}
inline void solve(const char* p){
    LL n=strlen(p);
    pre(p,n);
    LL len=n-d[n-1];
    if(n%len) cout<<1<<endl;
    else cout<<(n+len-1)/len<<endl;
}
int main(void){
   	cin.tie(0);std::ios::sync_with_stdio(false);
    while(cin>>s){
        if(s[0]=='.') break;
        solve(s);
    }
   	return 0;
}
